<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.4.2/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.4.2/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.4.2/themes/icon.css"/>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>个人调班</title>
</head>
<body>
	<script type="text/javascript">
		$(function() {
			/* 员工清单查找 */
			$('#empid').textbox({
				icons : [ {
					iconCls : 'icon-add',
					handler : function(e) {
						$("#peraddfindall").dialog("open");
						//双击获取值
						$('#personal_shet').datagrid({onDblClickRow:function(index,row){
								var paperinsertid=row.STAIN_ID;
								var paperinsertname=row.STAIN_NAME;
								$('#empid').textbox("setValue",paperinsertid);
								$('#empname').textbox("setValue",paperinsertname);
								//关闭窗口
								$('#peraddfindall').dialog('close');
							}
						});
					}
				}]
			});
			/* 原班组清单查找 */
			$('#teamId').textbox({
				icons : [ {
					iconCls : 'icon-add',
					handler : function(e) {
						$("#personfindalls").dialog("open");
						//双击获取值
						$('#personal_shets').datagrid({onDblClickRow:function(index,row){
								var paperinsertid=row.TEAM_ID;
								var paperinsertname=row.TEAM_NAME;
								$('#teamId').textbox("setValue",paperinsertid);
								$('#teamname').textbox("setValue",paperinsertname);
								//关闭窗口
								$('#personfindalls').dialog('close');
							}
						});
					}
				}]
			});
			/* 目标班组清单查找 */
			$('#mubiaoteamId').textbox({
				icons : [ {
					iconCls : 'icon-add',
					handler : function(e) {
						$("#personfindalls").dialog("open");
						//双击获取值
						$('#personal_shets').datagrid({onDblClickRow:function(index,row){
								var paperinsertid=row.TEAM_ID;
								var paperinsertname=row.TEAM_NAME;
								$('#mubiaoteamId').textbox("setValue",paperinsertid);
								$('#mubiaoteamname').textbox("setValue",paperinsertname);
								//关闭窗口
								$('#personfindalls').dialog('close');
							}
						});
					}
				}]
			});
			//返回
			$('.returnteam').linkbutton({
				onClick : function() {
					$("#teamshet").panel({
						href : "to_core_personal"
					});
				}
			});
			//
			$(".submit_teampera_add").linkbutton({onClick:function(){
				$("<form method='post'>").appendTo(document.body).form({
					url: 'shq_personalse_adds',
					onSubmit: function(params){
						params["stainId"] = $("#empid").textbox("getText");
						params["stainName"] = $("#empname").textbox("getValue");
						params["teamId"] = $("#mubiaoteamId").textbox("getValue");
						params["teamName"] = $("#mubiaoteamname").textbox("getValue");
						/* params["teamTakeeffect"] = $("#statesone").datetimebox("getText");
						params["teamLnvalid"] = $("#endtwe").datetimebox("getText");
						params["teamRemarks"] = $("#yythree").textbox("getText"); */
					},
					success:function(v){
						v = eval("(" + v + ")");
						if(v.success){
							$("#teamshet").panel({
								href : "to_core_personal"
							});
						}else{
							$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
						}
					}
				}).submit();
			}});
			
		});
	</script>

	<div id="teamshet" class="easyui-panel"
		data-options="fit:true,border:false">
		<div style="margin: 15px">
			<div id="insert_bt" class="insert_bt" style="margin: 10px">
				<a href="#" class="easyui-linkbutton returnteam" iconCls="icon-reload"
					plain="true" title="返回" data-options="text:'返回'"></a> <a
					class="easyui-linkbutton submit_teampera_add"
					data-options="text:'添加',iconCls:'icon-add',plain:true"></a> <span
					style="float: right; font-size: 12px; margin-top: 5px;margin-right: 10px;">新增：班组</span>
			</div>

			<div style="font-size: 14px;">概要</div>
			<div
				style="border-top: 2px solid #19aa8d; width: 400px; height: 180px; display: inline-block;">
				<table cellspacing="10">
					<tbody>
						<tr>
							<td><input class="easyui-textbox" id="empid"
								data-options="label:'*员工', width:150,labelWidth:50" /></td>
							<td><input class="easyui-textbox" id="empname"
								data-options="width:150" /></td>
						</tr>
						<tr>
							<td><input class="easyui-textbox" id="teamId"
								data-options="label:'*原班组', width:150,labelWidth:60" /></td>
							<td><input class="easyui-textbox" id="teamname"
								data-options="width:150" /></td>
						</tr>
						<tr>
							<td><input class="easyui-textbox" id="mubiaoteamId"
								data-options="label:'*目标班组', width:150,labelWidth:75" /></td>
							<td><input class="easyui-textbox" id="mubiaoteamname"
								data-options="width:150" /></td>
						</tr>
					</tbody>
				</table>
			</div>
			<div
				style="border-top: 2px solid #19aa8d; height: 180px; width: 400px; display: inline-block; margin-left: 10px">
				<table cellspacing="10">
					<tbody>
						<tr>
							<td><input id="endtwe" class="easyui-datetimebox"
								data-options="label:'*过账日期', width:350,labelWidth:130" /></td>
						</tr>
						<tr>
							<td><input id="statesone" class="easyui-datetimebox"
								data-options="label:'*生效时日', width:350,labelWidth:130" /></td>
						</tr>
						<tr>
							<td><input id="endtwe" class="easyui-datetimebox"
								data-options="label:'*失效时日', width:350,labelWidth:130" /></td>
						</tr>
					</tbody>
				</table>
			</div>
			<div style="font-size: 14px;">备注</div>
			<div
				style="border-top: 2px solid #19aa8d; width: 800px; height: 130px; display: inline-block; margin-right: 15px; padding-top: 10px;">
				<input id="yythree" class="easyui-textbox"
					data-options="width:800,height:100,multiline:true" />
			</div>
			<!--dialog1-->
			<!--清单查找-->
			<div id="peraddfindall" class="easyui-dialog"
				data-options="
				width:450,
				height:405,
				title:'清单查找-考勤员工',
				bodyCls:'awby',
				modal:true,
				closed:true,
				buttons:[{
						text:'添加',
						iconCls:'icon-ok',
						handler:function(){
							$('#f1').form({
							onSubmit:function(){
								//验证表单
								return $(this).form('validate');
								<!-- row获取选中行 -->
								var row=$('#teamshet').datagrid('getSelected');
								<!-- paperinsertid获取行id，paperinsertname获取行name -->
								var paperinsertid=row.stainId;
								var paperinsertname=row.stainName;
								$('#deptid').textbox('setValue',paperinsertid);
								$('#stainName_add').textbox('setValue',paperinsertname);
							},
							success:function(v){
								$.messager.alert('提示','恭喜，添加成功！');
								$('#peraddfindall').dialog('close');
								location.reload();
							}
						}).submit();
				}
			},{
				text:'继续添加',
				handler:function(){
					$('#f1').form('reset');
				}
			},{
				text:'关闭',
				iconCls:'icon-cancel',
				handler:function(){
					$('#peraddfindall').dialog('close');
				}
			}]">
				<div>
					<form action="">
						<table id="list_lookup">
							<tr>
								<td><input class="easyui-datebox"
									data-options="label:'参考日期', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-textbox"
									data-options="label:'员工', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-textbox"
									data-options="label:'名称', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-combobox"
									data-options="label:'班组', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-combobox"
									data-options="label:'部门', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td></td>
								<td><a class="easyui-linkbutton">模糊查询</a></td>
								<td><a class="easyui-linkbutton">精确查询</a></td>
							</tr>
						</table>
					</form>
				</div>
				<table class="easyui-datagrid" id="personal_shet"
					data-options="   
				method:'post',
				pagination:true,     
				pageSize:5,   
				url:'findallemp',  
				pageList: [5,10,15,20,25], 
				rownumbers:true,
				Striped:true, 
				singleSelect:true,
				striped:true
				">
					<thead>
						<tr>
							<th data-options="field:'STAIN_ID'">员工编号</th>
							<th data-options="field:'STAIN_NAME'">员工名称</th>
						</tr>
					</thead>
					<tbody>
					</tbody>
				</table>
			</div>
		</div>
		<!--班组清单查找-->
			<div id="personfindalls" class="easyui-dialog"
				data-options="
				width:450,
				height:405,
				title:'清单查找-考勤员工',
				bodyCls:'awby',
				modal:true,
				closed:true,
				buttons:[{
						text:'添加',
						iconCls:'icon-ok',
						handler:function(){
							$('#f1').form({
							onSubmit:function(){
								//验证表单
								return $(this).form('validate');
								<!-- row获取选中行 -->
								var row=$('#teamshet').datagrid('getSelected');
								<!-- paperinsertid获取行id，paperinsertname获取行name -->
								var paperinsertid=row.stainId;
								var paperinsertname=row.stainName;
								$('#deptid').textbox('setValue',paperinsertid);
								$('#stainName_add').textbox('setValue',paperinsertname);
							},
							success:function(v){
								$.messager.alert('提示','恭喜，添加成功！');
								$('#peraddfindall').dialog('close');
								location.reload();
							}
						}).submit();
				}
			},{
				text:'继续添加',
				handler:function(){
					$('#f1').form('reset');
				}
			},{
				text:'关闭',
				iconCls:'icon-cancel',
				handler:function(){
					$('#peraddfindall').dialog('close');
				}
			}]">
				<div>
					<form action="">
						<table id="list_lookup">
							<tr>
								<td><input class="easyui-datebox"
									data-options="label:'参考日期', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-textbox"
									data-options="label:'员工', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-textbox"
									data-options="label:'名称', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-combobox"
									data-options="label:'班组', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td><input class="easyui-combobox"
									data-options="label:'部门', width:200,labelWidth:60" /></td>
							</tr>
							<tr>
								<td></td>
								<td><a class="easyui-linkbutton">模糊查询</a></td>
								<td><a class="easyui-linkbutton">精确查询</a></td>
							</tr>
						</table>
					</form>
				</div>
				<table class="easyui-datagrid" id="personal_shets"
					data-options="   
				method:'post',
				pagination:true,     
				pageSize:5,   
				url:'to_findallone_team',  
				pageList: [5,10,15,20,25], 
				rownumbers:true,
				Striped:true, 
				singleSelect:true,
				striped:true
				">
					<thead>
						<tr>
							<th data-options="field:'TEAM_ID'">班组编号</th>
							<th data-options="field:'TEAM_NAME'">班组名称</th>
						</tr>
					</thead>
					<tbody>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</body>
</html>